<#include "*/component/Tags.ftl"/>
<@Title/>
<@ClassAnnotation>
@RestController
@RequestMapping("/api/v1/admin/${entity.table.module}/${entity.table.lastname}")
@Api(tags = "后台管理-${entity.table.comment}")
@Slf4j
@Validated
</@ClassAnnotation>
public class ${clazz.name} {

${'\t'}@Autowired
${'\t'}private ${entity.entityName}Service ${entity.objectName}Service;

${'\t'}@OperLog(title = "获取${entity.table.comment}分页", businessType = BusinessType.OTHER)
${'\t'}@ApiOperation(value = "获取${entity.table.comment}分页",
${'\t'}${'\t'}extensions = {
${'\t'}${'\t'}${'\t'}@Extension(name = "resource", properties = {
${'\t'}${'\t'}${'\t'}${'\t'}@ExtensionProperty(name = "verifyToken", value = "true"),
${'\t'}${'\t'}${'\t'}${'\t'}@ExtensionProperty(name = "roleCodes", value = ""),
${'\t'}${'\t'}${'\t'}${'\t'}@ExtensionProperty(name = "resourceType", value = "${entity.table.module}"),
${'\t'}${'\t'}${'\t'}${'\t'}@ExtensionProperty(name = "adminForRole", value = "false")
${'\t'}${'\t'}${'\t'}})
${'\t'}${'\t'}})
${'\t'}@GetMapping(value = "/page")
${'\t'}public Result<ListVo<${entity.entityName}ListItemVO>> page(${entity.entityName}Query query) {

${'\t'}${'\t'}return Result.success(${entity.objectName}Service.page(query));
${'\t'}}

${'\t'}@OperLog(title = "获取${entity.table.comment}详情", businessType = BusinessType.OTHER)
${'\t'}@ApiOperation(value = "获取${entity.table.comment}详情",
${'\t'}${'\t'}extensions = {
${'\t'}${'\t'}${'\t'}@Extension(name = "resource", properties = {
${'\t'}${'\t'}${'\t'}${'\t'}@ExtensionProperty(name = "verifyToken", value = "true"),
${'\t'}${'\t'}${'\t'}${'\t'}@ExtensionProperty(name = "roleCodes", value = ""),
${'\t'}${'\t'}${'\t'}${'\t'}@ExtensionProperty(name = "resourceType", value = "${entity.table.module}"),
${'\t'}${'\t'}${'\t'}${'\t'}@ExtensionProperty(name = "adminForRole", value = "false")
${'\t'}${'\t'}${'\t'}})
${'\t'}${'\t'}})
${'\t'}@GetMapping(value = "/get-profile")
${'\t'}public Result<${entity.entityName}ProfileVO> getProfile(
${'\t'}${'\t'}@RequestParam(name = "id", required = false) @NotNull(message = "主键不能为空") @ApiParam(value = "主键", required = true) ${entity.primaryField.type} id) {
${'\t'}${'\t'}return Result.success(${entity.objectName}Service.getProfile(id));
${'\t'}}

${'\t'}@OperLog(title = "添加${entity.table.comment}", businessType = BusinessType.OTHER)
${'\t'}@ApiOperation(value = "添加${entity.table.comment}",
${'\t'}${'\t'}extensions = {
${'\t'}${'\t'}${'\t'}@Extension(name = "resource", properties = {
${'\t'}${'\t'}${'\t'}${'\t'}@ExtensionProperty(name = "verifyToken", value = "true"),
${'\t'}${'\t'}${'\t'}${'\t'}@ExtensionProperty(name = "roleCodes", value = ""),
${'\t'}${'\t'}${'\t'}${'\t'}@ExtensionProperty(name = "resourceType", value = "${entity.table.module}"),
${'\t'}${'\t'}${'\t'}${'\t'}@ExtensionProperty(name = "adminForRole", value = "false")
${'\t'}${'\t'}${'\t'}})
${'\t'}${'\t'}})
${'\t'}@PostMapping(value = "/add")
${'\t'}public Result add(
${'\t'}${'\t'}@Valid @RequestBody ${entity.entityName}AddForm form) {
${'\t'}${'\t'}${entity.objectName}Service.add(form);
${'\t'}${'\t'}return Result.success();
${'\t'}}

${'\t'}@OperLog(title = "修改${entity.table.comment}", businessType = BusinessType.OTHER)
${'\t'}@ApiOperation(value = "修改${entity.table.comment}",
${'\t'}${'\t'}extensions = {
${'\t'}${'\t'}${'\t'}@Extension(name = "resource", properties = {
${'\t'}${'\t'}${'\t'}${'\t'}@ExtensionProperty(name = "verifyToken", value = "true"),
${'\t'}${'\t'}${'\t'}${'\t'}@ExtensionProperty(name = "roleCodes", value = ""),
${'\t'}${'\t'}${'\t'}${'\t'}@ExtensionProperty(name = "resourceType", value = "${entity.table.module}"),
${'\t'}${'\t'}${'\t'}${'\t'}@ExtensionProperty(name = "adminForRole", value = "false")
${'\t'}${'\t'}${'\t'}})
${'\t'}${'\t'}})
${'\t'}@PostMapping(value = "/update")
${'\t'}public Result update(
${'\t'}${'\t'}@Valid @RequestBody ${entity.entityName}UpdateForm form) {
${'\t'}${'\t'}return Result.success(${entity.objectName}Service.update(form));
${'\t'}}

${'\t'}@OperLog(title = "删除${entity.table.comment}", businessType = BusinessType.OTHER)
${'\t'}@ApiOperation(value = "删除${entity.table.comment}",
${'\t'}${'\t'}extensions = {
${'\t'}${'\t'}${'\t'}@Extension(name = "resource", properties = {
${'\t'}${'\t'}${'\t'}${'\t'}@ExtensionProperty(name = "verifyToken", value = "true"),
${'\t'}${'\t'}${'\t'}${'\t'}@ExtensionProperty(name = "roleCodes", value = ""),
${'\t'}${'\t'}${'\t'}${'\t'}@ExtensionProperty(name = "resourceType", value = "${entity.table.module}"),
${'\t'}${'\t'}${'\t'}${'\t'}@ExtensionProperty(name = "adminForRole", value = "false")
${'\t'}${'\t'}${'\t'}})
${'\t'}${'\t'}})
${'\t'}@PostMapping(value = "/delete")
${'\t'}public Result delete(
${'\t'}${'\t'}@RequestParam(name = "id", required = false) @NotNull(message = "主键不能为空") @ApiParam(value = "主键", required = true) ${entity.primaryField.type} id) {
${'\t'}${'\t'}return Result.success(${entity.objectName}Service.delete(id));
${'\t'}}

}
